<!doctype html>
<html lang="en">
<head>
    @include('web.layout.head')
    <link rel="stylesheet" href="{{mix('/css/web/user/shop_design.css')}}">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>
<body>

@include('web.layout.header')
@include('web.layout.user_tab')
<div class="base_member_content">
    <div class="w1200">
      @include('web.layout.seller_nav')
      <div class="nav_right flr">
            <div class="base_content">
                <div class="line_title">模板选择</div>
                <div class="my-subnav f-cb">
                    <ul>
                        <li class="cur">
                            <a href="{{asset('/member/seller/shop_design_templet')}}" class="jm_hover">
                                模板选择
                            </a><i></i>
                        </li>
                        <li>
                            <a href="{{asset('/member/seller/design')}}" class="jm_hover">
                                banner设置
                            </a><i></i>
                        </li>
                        <li>
                            <a href="{{asset('/member/seller/shop_design_custom')}}" class="jm_hover">
                                自定义分类
                            </a><i></i>
                        </li>
                    </ul>
                </div>
                <div class="tit_box">
                    <h2>请选择商铺模板</h2>
                </div>
                <div class="templet_list fl">
                  <ul>
                      @if(isset($shop))
                          @foreach($list as $k=>$v)
                            <li class="{{$shop['sp_templete']==$v['id']?'dq':''}}" data-id="{{$v['id']}}">
                                <div class="img fl">
                                  <img src="{{asset($v['snapshot'])}}">
                                </div>
                                <span>{{$v['name']}}{{$shop['sp_templete']==$v['id']?'（默认）':''}}</span>
                            </li>
                          @endforeach
                      @endif
                  </ul>
                </div>
            </div>
        </div>
    </div>
</div>
@include('web.layout.footer')
<script type="text/javascript">
$(function(){
  //选择模板
  $('.templet_list ul li').click(function(){
      var id = $(this).attr('data-id');
      if($(this).hasClass('dq')){
        return false;
      }
      layer.confirm('确定设置为默认模板？', {
          btn: ['确定', '取消'] //可以无限个按钮
      }, function (index) {

          $.ajax({
              url: "{{url('/member/seller/shop_design_templet')}}/"+id,
              type: 'put',
              dataType: 'json',
              data: {id: id},
              success: function (data) {
                  if (0 == data.code) {
                      layer.alert("设置成功", {
                          icon: 1
                      }
                              , function () {
                          location.reload();
                      }
                      );
                  } else {
                      layer.alert(data.message, {
                          icon: 2
                      });
                  }
              }
          });
      }, function (index, layero) {
          layer.close(index);
      });
  });
})
</script>
</body>
</html>